package com.unity3d.lessonapp3;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TextView txtView=findViewById(R.id.textView);
        txtView.setText("湖南中医药大学");
        txtView.setTextSize(40);
        txtView.setTextColor(getResources().getColor(R.color.purple_200));

        Student stu=new Student();

        Button button=findViewById(R.id.button);

        button.setOnClickListener(
                (view)->{
                    finish();
                    //intent()方法有两个参数，前者是当前页面，后者是要跳转到的目标页面
                    stu.id="202001020216";
                    stu.age=19;
                    stu.name="starry";

                    Intent intent=new Intent(MainActivity.this,MainActivity2.class);
                    intent.putExtra("name","湖南中医药大学");
                    intent.putExtra("student",stu);
                    startActivity(intent);
                }
        );




        //        button.setOnClickListener(new MyOnclick());
//
//        button.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                Log.i("way2","way2:Good Morning!");
//            }
//        });

    }
}

//class MyOnclick implements View.OnClickListener{
//
//    @Override
//    public void onClick(View view) {
//        Log.i("way1","way1:hello world");
//    }
//}
